<?php	
require_once 'PHPExcel.php';       
require_once 'PHPExcel/Writer/Excel5.php';


$array = array ();   
$array [1] = array ('1' => 'b1', '2' => 'i1', '3' => 'u1', '4' => 'u1', '5' => 'u1' );
$array [2] = array ('1' => 'b2', '2' => 'i2', '3' => 'u2', '4' => 'u2', '5' => 'u2' ); 
$array [3] = array ('1' => 'b3', '2' => 'i3', '3' => 'u3', '4' => 'u3', '5' => 'u3' );
$array [4] = array ('1' => 'b4', '2' => 'i4', '3' => 'u4', '4' => 'u4', '5' => 'u4' ); 
$array [5] = array ('1' => 'b5', '2' => 'i5', '3' => 'u5', '4' => 'u5', '5' => 'u5' ); 
$array [6] = array ('1' => 'b6', '2' => 'i6', '3' => 'u6', '4' => 'u6', '5' => 'u6' ); 
$array [7] = array ('1' => 'b7', '2' => 'i7', '3' => 'u7', '4' => 'u7', '5' => 'u7' );  





$objExcel=new PHPExcel();


// 创建文件格式写入对象实例, uncomment       
$objWriter = new PHPExcel_Writer_Excel5($objExcel);      
    
//设置文档基本属性       
$objProps = $objExcel->getProperties();       
$objProps->setCreator("WK");       
$objProps->setLastModifiedBy("2015-07-16");       
$objProps->setTitle("测试");       
$objProps->setSubject("主题");       
$objProps->setDescription("这是描述");       
$objProps->setKeywords("关键字");       
$objProps->setCategory("目录"); 

$objExcel->setActiveSheetIndex(0);       
$objActSheet = $objExcel->getActiveSheet();    
$objActSheet->setTitle('当前活动sheet');    


$character=array('','A','B','C','D','E','F','G');
$i=1;
$j=1;
foreach($array as $list)
{
	$j=1;
	foreach($list as $k=>$v)
	{
		$objActSheet->setCellValue($character[$j].$i,$list[$k]);
		$j++;
	}
	$i++;
}


$outputFileName = "tables/"."addminus.xls";  

header("Content-Type: application/force-download"); 
   header("Content-Type: application/octet-stream"); 
   header("Content-Type: application/download"); 
   header('Content-Disposition:inline;filename="'.$outputFileName.'"'); 
   header("Content-Transfer-Encoding: binary"); 
   header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 
   header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
   header("Pragma: no-cache"); 
   $objWriter->save('php://output'); 
// $objWriter->save($outputFileName); 
// echo("<a href='tables/addminus.xls' mce_href='tables/addminus.xls' target='_blank'>点击下载电子表</a>");  

